package main;

import model.Cliente;
import model.Coligada;

import org.hibernate.Session;

import util.HibernateUtil;

public class Teste {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Session session = HibernateUtil.getSessionfactory().openSession();
		
		session.beginTransaction();
		
		Coligada coligada = new Coligada();
		
		coligada.setNomeColigada("GOIANIA");
		session.save(coligada);
		
		
		//coligada = (Coligada) session.get(Coligada.class, new Long(1));
		//session.getTransaction().commit();
		Cliente cliente = new Cliente();
		cliente.setColigada(coligada);
		cliente.setNomcli("JULIO CESAR");
		
		
		session.save(cliente);
		//session.getTransaction().commit();
		coligada.setNomeColigada("AP GOIANIA");
		session.update(coligada);
		
		coligada = (Coligada) session.get(Coligada.class, new Long(1));
		session.delete(coligada);
		
		session.getTransaction().commit();

	}

}
